from django.db import models
import mongoengine
from mongoengine import *

from calc.settings import DBNAME

connect(DBNAME)

# Create your models here.
class SocialAccount(EmbeddedDocument):
	network_type = StringField(max_length=64)
	username = StringField(max_length=64)
	password = StringField(max_length=64)

class Message(EmbeddedDocument):
	sender_email = EmailField()
	receiver_email = EmailField()
	send_date = DateTimeField()
	content = StringField()
	carpool_no = IntField()
	msg_type = StringField()
	msg_status = StringField()

class Users(Document):
	name = StringField(max_length=64,required = True)
	email_address = EmailField(required = True)
	password = StringField(max_length=64, required = True)
	university = StringField(max_length=64)
	credit_score= DecimalField()
	friend_list = ListField(IntField())
	socialnetwork_account = ListField(EmbeddedDocumentField(SocialAccount))
	group_list = ListField(IntField())
	messagebox = ListField(EmbeddedDocumentField(Message))
		

